package com.quanyue.music.file.service.impl;

import com.quanyue.music.domain.constant.FMChannel;
import com.quanyue.music.file.api.ListenRecordService;
import com.quanyue.music.file.mapper.ListenRecordMapper;
import entity.UserRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.Future;

@Service
public class ListenRecordServiceImpl implements ListenRecordService {

    @Autowired
    private ListenRecordMapper listenRecordMapper;

    @Async
    @Override
    public Future <List <UserRecord>> findLongByChannel(FMChannel channel, List <String> userId) {
        List<UserRecord> result = listenRecordMapper.findLongByChannel(channel, userId);
        return new AsyncResult <List<UserRecord>>(result);
    }
}
